package com.approval.approvalapp.center.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.approval.approvalapp.R;
import com.approval.approvalapp.center.acitivty.ThingsCensusDetailActivity;
import com.approval.approvalapp.center.bean.ThingsCensusBean;
import com.approval.approvalapp.center.bean.ThingsCensusDetailBean;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * @author superman
 * @date 2019/5/9
 */
public class ThingsCensusDetailAdapter extends BaseRecycleListAdapter<ThingsCensusDetailBean> {


    public ThingsCensusDetailAdapter(List<ThingsCensusDetailBean> mList, Context context) {
        super(mList, context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.things_census_detail_item;
    }

    @Override
    public RecyclerView.ViewHolder createHolder(View view) {
        return new ViewHolder(view);
    }

    @Override
    protected void onBindDefaultViewHolder(RecyclerView.ViewHolder holder, ThingsCensusDetailBean bean, int position) {
        if(holder instanceof  ViewHolder){
            ((ViewHolder) holder).setData(bean);
        }
    }

    public class ViewHolder extends RecyclerView.ViewHolder{
        @Bind(R.id.tv_name1)
        TextView tvName1;
        @Bind(R.id.tv_name2)
        TextView tvName2;
        @Bind(R.id.tv_name3)
        TextView tvName3;
        @Bind(R.id.tv_name4)
        TextView tvName4;
        @Bind(R.id.tv_name5)
        TextView tvName5;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }

        public void setData(final ThingsCensusDetailBean bean) {

            tvName1.setText(bean.getTitle() +"");
            tvName2.setText(bean.getOne() +"");
            tvName3.setText(bean.getTwo()+"");
            tvName4.setText(bean.getThree() +"");
            tvName5.setText(bean.getTotal() +"");

        }
    }
}
